package com.sx.manage.controller.consumer.person;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.consumer.referee.RefereeWebServiceImpl;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.model.manage.mybatis.form.consumer.MPersonalConsumerNetworkForm;
import com.sx.model.manage.mybatis.form.consumer.feedback.MRefereeViewForm;
import com.sx.model.manage.mybatis.vo.consumer.MPersonalConsumerNetworkVO;
import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;

/**
 * 注册奖励领取 controller
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/register/award")
public class MRegisterAwardController extends MBaseController{
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	@Resource(name="refereeWebServiceImpl")
	private RefereeWebServiceImpl refereeWebServiceImpl;
	
	/**
	 * 跳转到 列表界面
	 */
	@RequestMapping(value = "individualConsumer")
	public ViewAndModel consumerview() {
		log.debug("推荐发钱界面跳转");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/registerAwardConsumer");
		return model;
	}
	/** 获取用户分页信息 */
	@RequestMapping(value = "page")
	@ResponseBody
	public ResultListVO<MPersonalConsumerNetworkVO> page(MPersonalConsumerNetworkForm form) {
		log.debug(" 推荐发钱界面跳转数据查询form={}",form);
		return refereeWebServiceImpl.queryNetworkConsumer(form);
	}
	/** 注册人领取奖励 */
	@RequestMapping(value = "receive")
	@ResponseBody
	public ResultBooleanVO receive(MRefereeViewForm form) {
		log.debug("推荐人领取奖励 consumer_id={}",form.getBind_consumer_id());
		return refereeWebServiceImpl.registerReceive(form.getBind_consumer_id());
	}
}
